package com.htthorizon.model.response;

import cn.hutool.crypto.digest.MD5;
import com.alibaba.fastjson2.JSON;
import com.htthorizon.common.core.utils.DateUtils;
import com.htthorizon.common.core.utils.StringUtils;

import java.util.*;

/**
 * @author mark
 */
public class TestDto {

    public static MetaInfoDto getMetaData(){
        List<MetaDataDto> list = new ArrayList<>();
        MetaDataDto dto1 = new MetaDataDto();
        dto1.setModel_tb("ads_cst_qsz_industry_expansion_mf");
        dto1.setMdtb_comm("业扩报装全过程信息查询");
        dto1.setCol_comment("答复供电方案时间");
        dto1.setName("reply_feed_scheme_end_tm");
        dto1.setType("string");
        list.add(dto1);
        MetaDataDto dto2 = new MetaDataDto();
        dto2.setModel_tb("ads_cst_qsz_industry_expansion_mf");
        dto2.setMdtb_comm("业扩报装全过程信息查询");
        dto2.setCol_comment("抄表码");
        dto2.setName("mr_num");
        dto2.setType("string");
        list.add(dto2);

        MetaDataDto dto3 = new MetaDataDto();
        dto3.setModel_tb("ads_cst_qsz_industry_expansion_mf");
        dto3.setMdtb_comm("业扩报装全过程信息查询");
        dto3.setCol_comment("标准省公司单位编号");
        dto3.setName("std_provc_org_no");
        dto3.setType("Integer");
        list.add(dto3);

        MetaDataDto dto4 = new MetaDataDto();
        dto4.setModel_tb("ads_cst_qsz_industry_expansion_mf");
        dto4.setMdtb_comm("业扩报装全过程信息查询");
        dto4.setCol_comment("数据时间");
        dto4.setName("data_dt");
        dto4.setType("Integer");
        list.add(dto4);

        MetaDataDto dto5 = new MetaDataDto();
        dto5.setModel_tb("ads_cst_qsz_industry_expansion_mf");
        dto5.setMdtb_comm("业扩报装全过程信息查询");
        dto5.setCol_comment("城市名称");
        dto5.setName("std_county_org_nm");
        dto5.setType("Integer");
        list.add(dto5);

        MetaDataDto dto6 = new MetaDataDto();
        dto6.setModel_tb("ads_cst_qsz_industry_expansion_mf");
        dto6.setMdtb_comm("业扩报装全过程信息查询");
        dto6.setCol_comment("开放银行名称");
        dto6.setName("open_bank_nm");
        dto6.setType("Integer");
        list.add(dto6);

        MetaInfoDto metaInfoDto = new MetaInfoDto();
        metaInfoDto.setPageNum(1);
        metaInfoDto.setPageSize(40);
        metaInfoDto.setTotalNum(2);
        metaInfoDto.setRows(list);
        return metaInfoDto;
    }


    public static String getModelData(){
        Map<String,Object> jsonMap = new HashMap<>(4);
        jsonMap.put("errCode",0);
        jsonMap.put("requestId","1401216417004687239474612e737d");
        jsonMap.put("errMsg","success");

        RemoteDataInfoDto remoteDataInfoDto = new RemoteDataInfoDto();
        List<Map<String,Object>> list = new ArrayList<>();
        Map<String,Object> map1 = new HashMap<>();
        map1.put("data_dt","202310");
        map1.put("std_county_org_nm","湖南省电网工程公司本部");
        map1.put("open_bank_nm","");
        map1.put("std_county_org_no","L43021111104200000");
        map1.put("std_city_org_no","L43021111104100000");
        map1.put("in_amt","0");
        list.add(map1);

        Map<String,Object> map2 = new HashMap<>();
        map2.put("data_dt","202310");
        map2.put("std_county_org_nm","湖南省电网工程公司本部");
        map2.put("open_bank_nm","中国电力财务有限公司湖南分公司");
        map2.put("std_county_org_no","L43021111104200000");
        map2.put("std_city_org_no","L43021111104100000");
        map2.put("in_amt","1");
        list.add(map2);

        remoteDataInfoDto.setPageNum(1);
        remoteDataInfoDto.setPageSize(2);
        remoteDataInfoDto.setTotalNum(12);
        remoteDataInfoDto.setRows(list);

        jsonMap.put("data",remoteDataInfoDto);

        return JSON.toJSONString(jsonMap);
    }

    public static void main(String[] args) {

        System.out.println("ads_cst_qsz_industry_expansion_mf-reply_feed_scheme_end_tm2".hashCode());

        String metaCodeStr = StringUtils.joinWith("," , "modelId", "metaFieldName");
        System.out.println(metaCodeStr);

        String md5 = MD5.create().digestHex16(metaCodeStr);
        System.out.println(md5);

        Date date = new Date();
        date.setTime(1701221420125L);
        System.out.println(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,date));
    }
}
